<?php
require_once dirname(__FILE__) . '/../common.inc.php';
require_once dirname(__FILE__) . '/Image.class.php';
$image = new Image();
$myPdo = DbUtils::createPdoInst();

try {
  $sql = "CREATE TABLE IF NOT EXISTS `" . TABLE_NAME_PREFIX_CUSTOM . $image->folder . "_image`(
           `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
           `track_id` varchar(16) UNIQUE,
           `name` varchar(128),
           `name_on_server` varchar(64),
           `size` float,
           `width` float,
           `height` float,
           `link` varchar(512)
          )";
  $myPdo->exec($sql);
  
  $sql = "CREATE TABLE IF NOT EXISTS `" . TABLE_NAME_PREFIX_CUSTOM . $image->folder . "_note`(
           `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
           `track_id` varchar(16) UNIQUE,
           `image_id` int,
           `left` float,
           `top` float,
           `width` float,
           `height` float,
           `text` text
          )";
  $myPdo->exec($sql);
  
  $sql = "CREATE TABLE IF NOT EXISTS `" . TABLE_NAME_PREFIX_CUSTOM . $image->folder . "_number`(
           `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
           `track_id` varchar(16) UNIQUE,
           `image_id` int,
           `left` float,
           `top` float,
           `width` float,
           `height` float,
           `number` text
          )";
  $myPdo->exec($sql);
  
  $sql = "CREATE TABLE IF NOT EXISTS `" . TABLE_NAME_PREFIX_CUSTOM . $image->folder . "_line`(
           `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
           `track_id` varchar(16) UNIQUE,
           `image_id` int,
           `left` float,
           `width` float,
           `height` float,
           `top` float
          )";
  $myPdo->exec($sql);
  echo 'Completed Successfully.';
} catch (PDOException $e) {
  echo $e->getMessage();
}
?>